package com.example.kafaka;

import com.example.kafaka.producer.KafkaProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class KafakaApplication implements CommandLineRunner {

    public static void main(String[] args) {
        SpringApplication.run(KafakaApplication.class, args);
    }

    @Autowired
    KafkaProducer kafkaProducer;

    @Override
    public void run(String... args) throws Exception {
        for (int i = 0; i < 10; i++) {
            kafkaProducer.send("hello world" + i);
        }
    }


}
